/*
 * @Description: 设备管理
 * @Author: Wang ZhongWang
 * @Date: 2022-02-20 10:11:35
 * @LastEditTime: 2022-02-20 10:49:55
 * @LastEditors: Wang ZhongWang
 */

import request from '@/utils/request'

/**
 * 分页查询
 * @param query
 */
export function getListPage(query) {
  var params = JSON.parse(JSON.stringify(query))
  return request({
    url: '/iot/rule/pageList',
    method: 'post',
    data: params
  })
}

/**
 * 获取列表
 * @param query
 */
export function getList(query) {
  var params = JSON.parse(JSON.stringify(query))
  return request({
    url: '/iot/rule/list',
    method: 'post',
    data: params
  })
}

/**
 * 获取列表
 * @param query
 */
export function insertRule(query) {
  var params = JSON.parse(JSON.stringify(query))
  return request({
    url: '/iot/rule/insertRule',
    method: 'post',
    data: params
  })
}

export function updateRule(query) {
  var params = JSON.parse(JSON.stringify(query))
  return request({
    url: '/iot/rule/updateRule',
    method: 'post',
    data: params
  })
}

/**
 * 分页查询
 * @param query
 */
export function getRuleConditionsListPage(query) {
  var params = JSON.parse(JSON.stringify(query))
  return request({
    url: '/iot/ruleConditions/pageList',
    method: 'post',
    data: params
  })
}

/**
 * 获取列表
 * @param query
 */
export function getRuleConditionsList(query) {
  var params = JSON.parse(JSON.stringify(query))
  return request({
    url: '/iot/ruleConditions/list',
    method: 'post',
    data: params
  })
}

export function getRuleById(query) {
  var params = JSON.parse(JSON.stringify(query))
  return request({
    url: '/iot/rule/getRuleById',
    method: 'get',
    params: params
  })
}

export function deleteRuleById(query) {
  var params = JSON.parse(JSON.stringify(query))
  return request({
    url: '/iot/rule/deleteRuleById',
    method: 'get',
    params: params
  })
}

export function deleteRuleConditionById(query) {
  var params = JSON.parse(JSON.stringify(query))
  return request({
    url: '/iot/ruleConditions/deleteRuleConditionById',
    method: 'get',
    params: params
  })
}

export function getRuleAlarmPageList(query) {
  var params = JSON.parse(JSON.stringify(query))
  return request({
    url: '/iot/ruleAlarmList/pageList',
    method: 'post',
    data: params
  })
}

export function dataStatistic(query) {
  return request({
    url: '/iot/ruleAlarmList/dataStatistic',
    method: 'get',
    params: query
  })
}

export function timeStatistic(query) {
  return request({
    url: '/iot/ruleAlarmList/timeStatistic',
    method: 'get',
    params: query
  })
}

